import './index'
import Orders from '../modules/Order'
import OrderClassOrders from '../modules/order/Orders';
import OrderClassDetailData from '../modules/order/DetailData';
import OrderClassOrdersData from '../modules/order/OrdersData';
console.log("ok");


class Main {
    async main() {
        console.log("ok");
        
    }
    async adds() {
        let data = new OrderClassOrders();
        data = new OrderClassOrdersData();
        data.Goods[0] = new OrderClassDetailData();
        data.Goods[1] = new OrderClassDetailData();
        let rs = await Orders.Orders.adds(data)
        console.log(rs);
    }
    async del(id:number) {
        let rs = await Orders.Orders.del(id)
        console.log(rs);
    }
    async get(id: number, v: number) {
        let rs = await Orders.Orders.get(id, v)
        console.log(rs);
        return rs

    }
    async save() {
        console.log("测试修改");
        let rsDB = await this.get(307, 13)
        let order = rsDB;
        let orderDetail = rsDB.OrderDetail;
        let orderVersion = rsDB.OrdersVersion;
        //添加订单
        for (const key in orderDetail) {
            orderDetail[key].Memo="01修改测试001"
            Object.assign(orderDetail[key], { "OrderID": order.OrderID });
        }

        console.log(orderDetail);
        let rs=await Orders.Orders.save(order,orderDetail,orderVersion)
    }
    async search() {
        // let keyword:string="test0001"
        // let keyword: string = "1601349049390"
        let keyword: string = "fsfds"
        let pageNum: number = 3
        let pageSize: number = 0
        let rs = await Orders.Orders.search(keyword, pageNum, pageSize)
        console.log(rs);
        
    }
}
let main = new Main();

// main.adds();
// main.del(283);
// main.save();
// main.get(290,13);
main.search();


// node .\dist\test\ordise.js